package basic.com.liz.learn.design.state;

public class Context
{
    private State state;
    
    public State getState()
    {
        return state;
    }
    
    public void setState(State state)
    {
        this.state = state;
    }
    
    public Context(State state)
    {
        super();
        this.state = state;
    }
    
    public void method()
    {
        String value = state.getValue();
        
        if ("1".equals(value))
        {
            state.m1();
        }
        else
        {
            state.m2();
        }
    }
}
